//
//  CinemaTableViewCell.m
//  UI_TabBarTest1(豆瓣)
//
//  Created by dllo on 16/6/26.
//  Copyright © 2016年 司昌宝. All rights reserved.
//

#import "CinemaTableViewCell.h"
#import "GetHeightTools.h"
#import "Cinema.h"
#define kWidth self.frame.size.width
#define kHeight self.frame.size.height
@interface CinemaTableViewCell ()

@property (nonatomic,retain) UIImageView *backImageView;
@property (nonatomic,retain) UILabel *cinemaNameLabel;
@property (nonatomic,retain) UILabel *addressLabel;
@property (nonatomic,retain) UILabel *telephoneLabel;

@end


@implementation CinemaTableViewCell



-(void)dealloc{
    [_cinema release];
    [super dealloc];
}


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self){
        self.backImageView = [[UIImageView alloc] init];
        self.backImageView.image = [UIImage imageNamed:@"bg_eventlistcell"];
        
        [self.contentView addSubview:self.backImageView];
        
        [_backImageView release];
        
        self.cinemaNameLabel = [[UILabel alloc] init];
        [self.backImageView addSubview:self.cinemaNameLabel];
        [_cinemaNameLabel release];
        
        self.addressLabel = [[UILabel alloc] init];
        [self.backImageView addSubview:self.addressLabel];
        [_addressLabel release];
        
        self.telephoneLabel = [[UILabel alloc] init];
        [self.backImageView addSubview:self.telephoneLabel];
        [_telephoneLabel release];
        
    }
    return self;
}

-(void)layoutSubviews{
    [super layoutSubviews];
    
    self.backImageView.frame = CGRectMake(10, 20, kWidth - 20, kHeight - 40);
    
    NSString *cinemaName = self.cinema.cinemaName;
    self.cinemaNameLabel.frame = CGRectMake(10, 0, kWidth - 40, 60);
    self.cinemaNameLabel.text = cinemaName;
    self.cinemaNameLabel.numberOfLines = 1;
    self.cinemaNameLabel.font = [UIFont systemFontOfSize:20.0];
    
    NSString *address = self.cinema.address;
    self.addressLabel.text = address;
    self.addressLabel.frame = CGRectMake(10, 60, kWidth - 40, [GetHeightTools heightWith:address withWidth:kWidth - 20 withFontSize:17.0]);
    self.addressLabel.numberOfLines = 0;
    
    NSString *telephone = self.cinema.telephone;
    self.telephoneLabel.text = telephone;
    self.telephoneLabel.frame = CGRectMake(10, 60 + [GetHeightTools heightWith:address withWidth:kWidth - 20 withFontSize:17.0], kWidth - 40, 60);
    self.addressLabel.numberOfLines = 1;
    
}



@end
